<?php

$page = $_GET['page'];
$req = ($page == 0)? 23 : 24;
$start = ($page == 0)? 0 : $page*24-1;

$con = mysqli_connect("192.168.0.170","adminmanzana","manzana-gt-2013","reciclatumanzana");

/*
$con = mysqli_connect("localhost","root","","manzana");
*/
if (mysqli_connect_errno())
{
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con, "SELECT * FROM users WHERE state=1 ORDER BY id DESC LIMIT ".$start.",".$req);

mysqli_close($con);

while ($row = mysqli_fetch_array($result)){
    $arr[] = $row;
}

echo json_encode($arr);
?>